#
#  RefObject
#  Copyright (C) 2010-2011 Shirow Miura (sharow)
#

.SUFFIXES: .c .o .h .exe
.PHONY: all clean

CFLAGS+=-Wall
CFLAGS+=-pedantic
CFLAGS+=-ansi

ifeq ($(shell uname -o),Cygwin)
 CFLAGS+=-mno-cygwin
endif

ifeq ($(DEBUG),yes)
 CFLAGS+=-g -ggdb
else
endif

INCDIR+=-I./
INCDIR+=-I../include
EXTLIB+=../librefobject.a

SOURCE+=$(shell find . -name "*.c")
EXE=$(subst .c,.exe, $(SOURCE))

all: ranlib $(EXE)

clean:
	rm -f $(EXE)
	rm -f *~
ranlib:
	ranlib $(EXTLIB)

# suffix rule
.c.exe:
	$(CC) $(CFLAGS) $(INCDIR) $< -o $@ $(EXTLIB)
